﻿using System;
using System.Collections.Generic;
using System.Collections;


namespace Resn.WhuPub.BLL
{
        public static class EnumExtension
        {
                public static List<T> GetEnums<T>(this Type type) where T:struct 
                {
                        List<T> result = new List<T>();

                        foreach (var name in Enum.GetNames(type))
                        {
                                T t = (T)Enum.Parse(type, name);
                                result.Add(t);
                        }

                        return result;


                        
                }

                //public static TEnum ParseEnum<TEnum>(this string value, bool ignoreCase = false) where TEnum : struct
                //{
                //        TEnum tenum;
                //        Enum.TryParse<TEnum>(value, ignoreCase, out tenum);
                //        return tenum;
                //}
        }
}
